<script lang="ts" setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { useBeforeunload } from '@/hooks/demo/beforeunload';
const { push } = useRouter();
const switchs = ref(false);
useBeforeunload(switchs);

const back = () => {
  history.back();
};
</script>

<template>
  <div class="p-2">
    <el-button plain size="default" @click="back">返回上一页</el-button>
    <el-switch class="p-2" v-model="switchs" />
    <el-link class="truncate" @click="push('/demo')">Demo index 页面</el-link>
  </div>
</template>

<style lang="scss" scoped></style>
